package group.raber.auth.service;

import group.raber.auth.entity.Role;
import group.raber.auth.entity.User;

import java.util.List;
import java.util.Map;

/**
 * Created by tisir<yangsong158@qq.com> on 2017-05-13
 */
public interface AuthService {

    public User getUser(Long userId);
    public User getUser(String userCode);
    public int saveUser(User user);
    public int deleteUser(Long userId);
    public Map<String,String> getUserProperties(Long userId);
    public int addUserProperty(Long userId,String propertyName,String propertyValue);
    public int removeUserProperty(Long userId,String propertyName);

    public boolean verifyPassword(Long userId,String password);
    void updatePassword(Long userId,String password);


    public Role getRole(Long roleId);
    public Role getRole(String roleCode);
    public int saveRole(Role role);
    public int deleteRole(Long roleId);
    public List<Role> getUserRoles(Long userId);
    public int grantRoleToUser(Long roleId,Long userId);
    public int revokeRoleFormUser(Long roleId,Long userId);
    public boolean userHasRole(String userCode,String roleCode);
    public boolean userHasRole(Long userId,Long roleId);
}
